package com.qianfeng.zhangwei.day26.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.List;

/**
 * @说 明：
 * @项目名称：Sz1504
 * @包 名： com.qianfeng.zhangwei.day26.adapter
 * @类 名： AppBaseAdapter
 * @创 建人： zhangwei
 * @创建时间：2015-07-20 15:10
 * @版 本：v1.0
 * @修 改人：
 * @修改时间：
 * @修改备注：
 */
public abstract class AppBaseAdapter<T> extends BaseAdapter {
    public List<T> list;
    public Context context;
    public LayoutInflater inflater;



    /**
     * @param list
     * @param context
     */
    public AppBaseAdapter(List<T> list, Context context) {
        this.list = list;
        this.context = context;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return list != null && list.size() > 0 ? list.size() : 0;
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        return getItemView(position, convertView, parent);
    }


    public abstract View getItemView(int position, View convertView, ViewGroup parent);


}
